package com.example.pinglun;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends AppCompatActivity {
private String[] text = {"烤鸭","回锅肉","茄子","宫保鸡丁"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        //运用适配器搭配桥梁
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_expandable_list_item_1,text);
        ListView listView = findViewById(R.id.list_view);
        listView.setAdapter(adapter);
    }
}